package com.abel.domain.types;

public enum PayMode {

	hourly ("H", "hourly"),
	annual ("A", "annual");
	
	private String payModeCode;
	
	private String payMode;
	
	private PayMode (String payModeCode, String payMode) {
		
		this.payModeCode = payModeCode;
		this.payMode = payMode;
		
	}
	
	
	
	/**
	 * @return the payMode
	 */
	public String getPayModeCode() {
		return payModeCode;
	}
	
	public String getPayMode() {
		return payMode;
	}

	public static String getPayModeByCode(String payModeCode) {
		
		if (payModeCode != null) {
			
			for (PayMode payMode : PayMode.values()) {
				
				if (payMode.getPayModeCode().equals(payModeCode)) {
					return payMode.getPayMode();
				}
			}
		}
		return null;
	}
	
	public static String getPayModeCode(String payMode) {
		
		if (payMode != null) {
			
			for (PayMode payMod : PayMode.values()) {
				
				if (payMod.getPayMode().equals(payMode)) {
					return payMod.getPayModeCode();
				}
			}
		}
		return null;
	}
}
